/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package entidades;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Daniel Cruz
 */
@Entity
@Table(name = "b_basic_tabl")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "BBasicTabl.findAll", query = "SELECT b FROM BBasicTabl b"),
    @NamedQuery(name = "BBasicTabl.findByBtbId", query = "SELECT b FROM BBasicTabl b WHERE b.btbId = :btbId"),
    @NamedQuery(name = "BBasicTabl.findByBtbNombre", query = "SELECT b FROM BBasicTabl b WHERE b.btbNombre = :btbNombre"),
    @NamedQuery(name = "BBasicTabl.findByBtbDescripcion", query = "SELECT b FROM BBasicTabl b WHERE b.btbDescripcion = :btbDescripcion"),
    @NamedQuery(name = "BBasicTabl.findByBtbEstado", query = "SELECT b FROM BBasicTabl b WHERE b.btbEstado = :btbEstado")})
public class BBasicTabl implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "btb_id")
    private Long btbId;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 100)
    @Column(name = "btb_nombre")
    private String btbNombre;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 255)
    @Column(name = "btb_descripcion")
    private String btbDescripcion;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 1)
    @Column(name = "btb_estado")
    private String btbEstado;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "btbId")
    private Collection<BBasicaTipo> bBasicaTipoCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "parentBtbId")
    private Collection<BBasicTabl> bBasicTablCollection;
    @JoinColumn(name = "parent_btb_id", referencedColumnName = "btb_id")
    @ManyToOne(optional = false)
    private BBasicTabl parentBtbId;

    public BBasicTabl() {
    }

    public BBasicTabl(Long btbId) {
        this.btbId = btbId;
    }

    public BBasicTabl(Long btbId, String btbNombre, String btbDescripcion, String btbEstado) {
        this.btbId = btbId;
        this.btbNombre = btbNombre;
        this.btbDescripcion = btbDescripcion;
        this.btbEstado = btbEstado;
    }

    public Long getBtbId() {
        return btbId;
    }

    public void setBtbId(Long btbId) {
        this.btbId = btbId;
    }

    public String getBtbNombre() {
        return btbNombre;
    }

    public void setBtbNombre(String btbNombre) {
        this.btbNombre = btbNombre;
    }

    public String getBtbDescripcion() {
        return btbDescripcion;
    }

    public void setBtbDescripcion(String btbDescripcion) {
        this.btbDescripcion = btbDescripcion;
    }

    public String getBtbEstado() {
        return btbEstado;
    }

    public void setBtbEstado(String btbEstado) {
        this.btbEstado = btbEstado;
    }

    @XmlTransient
    public Collection<BBasicaTipo> getBBasicaTipoCollection() {
        return bBasicaTipoCollection;
    }

    public void setBBasicaTipoCollection(Collection<BBasicaTipo> bBasicaTipoCollection) {
        this.bBasicaTipoCollection = bBasicaTipoCollection;
    }

    @XmlTransient
    public Collection<BBasicTabl> getBBasicTablCollection() {
        return bBasicTablCollection;
    }

    public void setBBasicTablCollection(Collection<BBasicTabl> bBasicTablCollection) {
        this.bBasicTablCollection = bBasicTablCollection;
    }

    public BBasicTabl getParentBtbId() {
        return parentBtbId;
    }

    public void setParentBtbId(BBasicTabl parentBtbId) {
        this.parentBtbId = parentBtbId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (btbId != null ? btbId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof BBasicTabl)) {
            return false;
        }
        BBasicTabl other = (BBasicTabl) object;
        if ((this.btbId == null && other.btbId != null) || (this.btbId != null && !this.btbId.equals(other.btbId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entidades.BBasicTabl[ btbId=" + btbId + " ]";
    }
    
}
